CopyKey

The CopyKey method copies a key and all its subkeys and named values from one registry key to another. If the destination key does not exist, the CopyKey method adds it to the registry.

Syntax

CopyKey FullKeynameSource, FullKeynameDest [,Flush]

Parameters

FullKeynameSource
A string that specifies the full name of the registry key to copy.

This can be a key on either a local or a remote machine. Keys on a remote machine are specified by prefixing the key name with the machine name. For example:

\\RemoteMachine\HKLM\Software\MyProg|MyValue


FullKeynameDest
A string that specifies the full name of the registry key that receives the copied named value. Like FullKeynameSource, this key can be on either a local or remote machine.
Flush
This optional parameter is a BOOLEAN that specifies whether the registry changes that this method makes should be immediately written to the disk.

If Flush is set to TRUE, the method writes the registry changes to the disk immediately. Note that immediately flushing registry changes to the disk may reduce server performance.

If Flush is FALSE, the method does not write the registry changes to the disk immediately. They are instead written to disk by the registry's lazy flusher or when the system shuts down.

The default is FALSE.

Example

The following example copies the key HKLM\Software\Microsoft\Java VM\Classpath to a remote machine, Serv2. Note that the optional Flush parameter is set to TRUE in the CopyKey method call.
<% 
Set Reg = Server.CreateObject("IISSample.Registry") 
Reg.CopyKey "HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM\Classpath", "\\Serv2\HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM\Classpath", True 
%>
 

Applies To

Registry Access Component